﻿using NetWing.Common.Data.SqlServer;
using NetWing.Model;
using System;
using System.Data;
using System.Data.SqlClient;

namespace NetWing.BPM.Admin.JydWodrmb
{
    
        public partial class print_printdysale : System.Web.UI.Page
        {
            protected string OrderID;
            protected string comname;
            protected string connman;
            protected string tel;
            protected string adddate;
            protected string deliveryDate;
            protected string jjy;
            protected string ywy;
            protected string explain;
            protected string huofa;
            protected string ys;
            protected string jedx;
            protected string jexx;
            protected string yufuk;
            protected string yufukuana;
            protected string address;


        protected JydOrderModel model;

            public DataTable dt = null;
            public DataTable dte = null;
            protected void Page_Load(object sender, EventArgs e)
            {
                string pid = Request["KeyId"];
                string dateii = Request["OrderID"];
                string sql = "select * from jydOrderDetail where  orderid='" + dateii + "'";
                string sqle = "select * from jydOrder where OrderID='" + dateii + "' and KeyId=" + pid;
                dt = SqlEasy.ExecuteDataTable(sql);
                dte = SqlEasy.ExecuteDataTable(sqle);
                string shname = "";
                foreach (DataRow dr in dte.Rows)
                {
                    shname += dr["OrderID"].ToString() + ",";
                }
                shname = shname.Substring(0, shname.Length - 1);

                model = new JydOrderModel();
                if (dte.Rows.Count > 0)
                {
                    model.OrderID = dte.Rows[0]["OrderID"].ToString();
                    model.comname = dte.Rows[0]["comname"].ToString();
                    model.connman = dte.Rows[0]["connman"].ToString();
                    model.tel = dte.Rows[0]["tel"].ToString();
                    adddate = dte.Rows[0]["adddate"].ToString();
                    deliveryDate = dte.Rows[0]["deliveryDate"].ToString();
                    model.jjy = dte.Rows[0]["jjy"].ToString();
                    model.ywy = dte.Rows[0]["ywy"].ToString();
                    model.explain = dte.Rows[0]["explain"].ToString();
                    model.huofa = dte.Rows[0]["huofa"].ToString();
                    model.ys = dte.Rows[0]["ys"].ToString();
                    model.jedx = dte.Rows[0]["jedx"].ToString();
                    jexx = dte.Rows[0]["jexx"].ToString();
                    yufuk = dte.Rows[0]["yufuk"].ToString();
                    model.yufukuana = dte.Rows[0]["yufukuana"].ToString();
                    

                    OrderID = model.OrderID;
                    comname = model.comname;
                    connman = model.connman;
                    tel = model.tel;
                    jjy = model.jjy;
                    ywy = model.ywy;
                    explain = model.explain;
                    huofa = model.huofa;
                    ys = model.ys;
                    jedx = model.jedx;
                    jedx = model.jedx;
                    yufukuana = model.yufukuana;
                    var str = SqlEasy.ExecuteScalar("select top 1 address from jydUser  where tell='" + tel + "'");

                    if(str!=DBNull.Value&&str!=null) {
                        address = str.ToString();
                    }
                    }
                else
                {

                }


            }

       
    }
    }